</para>
</formalpara>
+<formalpara>
+ <title><envar>GDK_RENDERING</envar></title>
+
+ <para>
+ If set, selects the way how GDK creates similar surfaces. This affects both the
+ functionality of the function gdk_window_create_similar_surface() as well as the
+ way GDK creates backing surfaces for double buffering. The following values can
+ be used:
+ <variablelist>
+
+ <varlistentry>
+ <term>similar</term>
+ <listitem><para>Create similar surfaces to the window in use. This is the
+ default behavior when the variable is not set.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>image</term>
+ <listitem><para>Always create image surfaces. This essentially turns off
+ all hardware acceleration inside GTK.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>recording</term>
+ <listitem><para>Always create recording surfaces. This causes bare rendering
+ to the backend without the creation of intermediate surfaces (Pixmaps in X)
+ and will likely cause flicker.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ All other values will be ignored and fall back to the default behavior. More
+ values might be added in the future.
+ </para>
+</formalpara>
+
<formalpara>
<title><envar>GDK_BACKEND</envar></title>
void
gdk_pre_parse_libgtk_only (void)
{
+ const char *rendering_mode;
+
gdk_initialized = TRUE;
/* We set the fallback program class here, rather than lazily in
g_unsetenv ("GDK_NATIVE_WINDOWS");
}
+ rendering_mode = g_getenv ("GDK_RENDERING");
+ if (rendering_mode)
+ {
+ if (g_str_equal (rendering_mode, "similar"))
+ _gdk_rendering_mode = GDK_RENDERING_MODE_SIMILAR;
+ else if (g_str_equal (rendering_mode, "image"))
+ _gdk_rendering_mode = GDK_RENDERING_MODE_IMAGE;
+ else if (g_str_equal (rendering_mode, "recording"))
+ _gdk_rendering_mode = GDK_RENDERING_MODE_RECORDING;
+ }
+
g_type_init ();
/* Do any setup particular to the windowing system */
#include "config.h"
#include "gdktypes.h"
-#include "gdkprivate.h"
+#include "gdkinternals.h"
#include <stdio.h>
-
guint _gdk_debug_flags = 0;
GList *_gdk_default_filters = NULL;
gchar *_gdk_display_name = NULL;
gchar *_gdk_display_arg_name = NULL;
gboolean _gdk_disable_multidevice = FALSE;
-
+GdkRenderingMode _gdk_rendering_mode = GDK_RENDERING_MODE_SIMILAR;
GDK_DEBUG_EVENTLOOP = 1 << 10
} GdkDebugFlag;
+typedef enum {
+ GDK_RENDERING_MODE_SIMILAR = 0,
+ GDK_RENDERING_MODE_IMAGE,
+ GDK_RENDERING_MODE_RECORDING
+} GdkRenderingMode;
+
extern GList *_gdk_default_filters;
extern GdkWindow *_gdk_parent_root;
extern guint _gdk_debug_flags;
+extern GdkRenderingMode _gdk_rendering_mode;
#ifdef G_ENABLE_DEBUG
window_surface = _gdk_window_ref_cairo_surface (window);
- surface = cairo_surface_create_similar (window_surface,
- content,
- width, height);
+ switch (_gdk_rendering_mode)
+ {
+ case GDK_RENDERING_MODE_RECORDING:
+ {
+ cairo_rectangle_t rect = { 0, 0, width, height };
+ surface = cairo_recording_surface_create (content, &rect);
+ }
+ break;
+ case GDK_RENDERING_MODE_IMAGE:
+ surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
+ content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_ARGB32,
+ width, height);
+ break;
+ case GDK_RENDERING_MODE_SIMILAR:
+ default:
+ surface = cairo_surface_create_similar (window_surface,
+ content,
+ width, height);
+ break;
+ }
cairo_surface_destroy (window_surface);